package com.wisdytech.linkdcs.common.handler;


import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.wisdytech.common.bean.Filter;

public abstract class BaseService <M extends BaseMapper<T>, T> {

  
    @Autowired
    private SqlSessionTemplate sqlSessionTemplate;
    
    public <V> V getDao(Class<V> type){
        
        return sqlSessionTemplate.getMapper(type);
    }
    
    /**
     * 
     * <p>Description: 分页查询前执行</p>
     * @param type 查询对象
     * @Param filter 分页对象
     * @return
     */
    public <V> V beforeList(Class<V> type,Filter filter){
        //设定分页数据
        PageHelper.startPage(filter.getNum(), filter.getSize());
        return this.sqlSessionTemplate.getMapper(type);
    }
    
    
    
    
}
